package com.example.aptech2008_hellofragment;

import android.annotation.SuppressLint;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

@SuppressLint("NewApi")
public class Fragment1 extends Fragment implements Transfer {
	EditText edt;
	FragmentManager mFragmentManage;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View root = inflater.inflate(R.layout.layout_fm1, container, false);
		Button btn = (Button) root.findViewById(R.id.send);
		edt = (EditText) root.findViewById(R.id.editText1);
		btn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				String name = edt.getText().toString();
				if (mListener != null) {
					mListener.onInputCompleteListener(name);
				}

			}
		});
		return root;
	}

	public interface onInputCompleteListener {
		public void onInputCompleteListener(String name);

	}

	onInputCompleteListener mListener;

	public void setonInputCompleteListener(onInputCompleteListener listener) {
		mListener = listener;
	}

	@Override
	public String tranData() {
		String str = edt.getText().toString();
		return str;
	}
}
